// iodc时引起占位问题
iframe {
  border: none;
}

fieldset {
  border: 1px solid var(--theme-gray-200);
  border-bottom-width: 0;
  border-left-width: 0;
  border-right-width: 0;
  border-image: linear-gradient(to right, #fff, var(--theme-gray-200) 15%, var(--theme-gray-200) 85%, #fff) 1;
  border-radius: 0;

  box-sizing: border-box;
  margin: 0;
}
legend {
  color: var(--theme-gray-600);
  padding: 0 1em;
  font-size: 0.9em;
}

a[href] {
  --a-color: var(--theme-link-color);
  --a-hover-color: var(--theme-link-hover-color);

  outline-offset: 10px;
  outline: 2px solid transparent;
  color: var(--a-color);
  transition: all 0.2s ease-in-out;
  border-radius: var(--theme-border-radius-sm);

  &:hover {
    color: var(--a-hover-color);
  }

  &:focus {
    outline-offset: 3.5px;
    outline-color: currentColor;
  }
}

/* 初始化 button 的样式*/
button {
  --button-size: 14px;
  --button-color: var(--theme-white);
  --button-hover-color: var(--button-color);
  --button-active-color: var(--theme-primary-emphasis);
  --button-radius: var(--theme-border-radius);
  --button-bg-color: var(--theme-primary);
  --button-hover-bg-color: var(--theme-primary-hover);
  --button-border-color: rgba(var(--theme-primary-rgb), 0.4);

  font-size: var(--button-size);
  border: 0.5px solid var(--button-border-color);
  background-color: var(--button-bg-color);
  color: var(--button-color);
  padding: 0.875em 1.25em;
  transition: all 0.2s;
  cursor: pointer;
  border-radius: var(--button-radius);
  line-height: 1;
  outline-offset: 5px;
  outline: 4px solid transparent;
  user-select: none;
  -webkit-user-select: none; // ios 中能生效

  &[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
    // pointer-events: fill;
  }
  &:not([disabled]) {
    &:hover {
      color: var(--button-hover-color);
      background-color: var(--button-hover-bg-color);
    }
    &:active {
      transition-duration: 0s;
      color: var(--button-active-color);
      text-shadow: 0 0.6px 0 rgba(255, 255, 255, 0.3);
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    &:not(:active):focus {
      transition: all 0.2s;
      outline-offset: 0;
      outline-color: var(--button-border-color);
    }
  }
}

input[type="checkbox"] {
  width: 1.2em;
  height: 1.2em;
  vertical-align: text-bottom;
  outline: 3px solid transparent;
  outline-offset: 5px;
  border-radius: 2px;

  color: var(--theme-primary);
  border: 2px solid var(--theme-primary);
  appearance: none;
  print-color-adjust: exact;

  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-color: var(--theme-white);
  transition: all 0.2s ease-in-out;

  &[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
  }

  &:not([disabled]) {
    &:focus {
      outline-offset: 0;
      outline-color: rgba(var(--theme-primary-rgb), 0.4);
    }
    &:checked {
      background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2216%22%20height=%2216%22%20fill=%22white%22%20viewBox=%220%200%2016%2016%22%3E%3Cpath%20d=%22M12.736%203.97a.733.733%200%200%201%201.047%200c.286.289.29.756.01%201.05L7.88%2012.01a.733.733%200%200%201-1.065.02L3.217%208.384a.757.757%200%200%201%200-1.06.733.733%200%200%201%201.047%200l3.052%203.093%205.4-6.425z%22/%3E%3C/svg%3E");
      background-color: currentColor;
    }
  }
}
input {
  &::-ms-clear,
  &::-ms-reveal {
    display: none; // 隐藏IE10+的清除按钮 以及查看密码按钮
  }
}

@media (prefers-color-scheme: dark) {
  fieldset {
    // border: 1px solid var(--theme-gray-200);
    border-image: linear-gradient(to right, var(--theme-gray-900), var(--theme-gray-700) 15%, var(--theme-gray-700) 85%, var(--theme-gray-900)) 1;
  }
  input[type="checkbox"] {
    background-color: var(--theme-gray-900);
  }
  a[href] {
    filter: invert(0.25);
  }
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  color: powderblue !important;
  -webkit-text-fill-color: powderblue !important;
  background-image: none;
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  background-color: transparent;
  transition: background-color 2147483647s ease-out 0s;
}
